import deepClone from "@/libs/deepClone";
import { reactive, toRefs } from "vue";

interface UseFormOption<T extends Object> {
  defaultFormData: T
  // rules: { [key: keyof T]: FormRule[] }
}

function useForm<T extends Object>(option: UseFormOption<T>) {
  let formData = reactive(option.defaultFormData)
  let defaultFormData = deepClone(option.defaultFormData) as T



  return {
    formData: toRefs(formData)
  }
}

export default useForm